<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>滚动到可视区</title>
  <style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }

    html,
    body {
      height: 100%;
    }

    .loading {
      width: 60%;
      border: 2px solid red;
      margin: auto;
      height: 400px;
      flex: flex;
      overflow-y: scroll;
    }

    .loading>div {
      margin-top: 10px;
      border: 2px solid green;
    }
  </style>
</head>
<!-- 
  滚动到可视区域document.querySelector(".loading").scrollIntoView()
-->

<body>
  <div class="loading">
    <div>
      <span>好人的</span>
    </div>
    <div>
      <span>坏人的吧</span>
    </div>
    <div>
      <span>狗屁了</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
    <div>
      <span>不知道</span>
    </div>
  </div>
</body>

</html>